home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / Mac OS USB DDK / Mac OS USB DDK 1.4.1 / USB Software Locator Kit / SampleDriverInstallerExample / CheckUSBUserFn.c < prev    next >
Encoding:
Text File  |  2000-04-25  |  1004 b   |  54 lines  |  [TEXT/CWIE]

  1. //
  2. //    CheckUSBRuleFn.c
  3. //
  4. //        
  5. //
  6. //        This code is used to verify that the desired version of USB is present.
  7. //
  8. //
  9.  
  10. #include <Types.h>
  11. #include <MixedMode.h>
  12. #include <Gestalt.h>
  13. #include <USB.h>
  14.  
  15. // this line replaces #include "ActionAtomHeader.h" used in previous 4.0.3 action atoms
  16. #include "InstallerScript.h"
  17.  
  18. ActionAtomResult CheckUSBVersFn( RuleFunctionPBPtr rulePBPtr );
  19.  
  20. enum {
  21.     uppRuleFuncProcInfo    = kCStackBased
  22.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  23.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(RuleFunctionPBPtr)))
  24. };
  25.  
  26. ProcInfoType __procinfo = uppRuleFuncProcInfo;
  27.  
  28. ActionAtomResult CheckUSBVersFn( RuleFunctionPBPtr rulePBPtr )
  29. {
  30.     long    result;
  31.     OSErr    err;
  32.         
  33.     err = Gestalt(gestaltUSBVersion, &result);
  34.     if (err)
  35.     {
  36.         return kFALSERuleFunctionResult;
  37.     }
  38.     else
  39.     {
  40.             // compare the refCon value which is the minimum value of USB that
  41.             // we are looking for
  42.         if (rulePBPtr->fRefCon <= result)
  43.             return kTRUERuleFunctionResult;
  44.         else
  45.             return kFALSERuleFunctionResult;
  46.     }
  47.  
  48. }
  49.  
  50.  
  51.  
  52.  
  53.  
  54.